package com.sgb.zhaocai.view.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.sgb.zhaocai.BR;
import com.sgb.zhaocai.R;
import com.sgb.zhaocai.entity.MarketPersonalEntitly;
import com.sgb.zhaocai.entity.MemberCompanyEntitly;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class MarketPersonalAdapter extends BaseRecycleAdapter<MarketPersonalEntitly> {
    private ImageView ivSelect;

    public MarketPersonalAdapter(Context context, List<MarketPersonalEntitly> datas) {
        super(context, R.layout.market_personal_items, datas);
    }

    @Override
    public void onBindViewHolder(ItemViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
    }

    @Override
    public void convert(ItemViewHolder holder, MarketPersonalEntitly entity) {
        holder.setBinding(BR.viewModel, entity);
        ivSelect = holder.itemView.findViewById(R.id.iv_select);
        ivSelect.setImageResource(entity.isCheck() ? R.drawable.icon_select_item : R.drawable.icon_unselecte);
        ivSelect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                iChildClick.onClick(entity);
            }
        });
    }
    private IChildClick iChildClick;
    public interface IChildClick {
        void onClick(MarketPersonalEntitly membercompanyentitly);
    }

    public void onIChildClick(IChildClick iChildClick) {
        this.iChildClick = iChildClick;
    }
}
